package fun.tan90.easylog;


import jakarta.annotation.Resource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowCallbackHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.sql.ResultSet;
import java.sql.SQLException;

@RestController
public class DbController {

    @Resource
    JdbcTemplate jdbcTemplate;

    @GetMapping("db")
    public void db() {
        jdbcTemplate.query("show databases", new RowCallbackHandler() {
            @Override
            public void processRow(ResultSet rs) throws SQLException {
                System.out.println(rs);
            }
        });
    }
}
